
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Introduction · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="document/1.写在前面的话.html" />
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter active" data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="document/1.写在前面的话.html">
            
                <a href="document/1.写在前面的话.html">
            
                    
                    写在前面的话
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="document/2.搭建环境.html">
            
                <a href="document/2.搭建环境.html">
            
                    
                    第一章 搭建环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" >
            
                <span>
            
                    
                    第二章 模型定义
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="document/3.sequelize 实例变量.html">
            
                <a href="document/3.sequelize 实例变量.html">
            
                    
                    2.1 实例变量方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="document/4.定义一个模型.html">
            
                <a href="document/4.定义一个模型.html">
            
                    
                    2.2 定义一个模型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="document/5.模型字段类型.html">
            
                <a href="document/5.模型字段类型.html">
            
                    
                    2.3 模型字段类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.4" data-path="document/6.导入与配置.html">
            
                <a href="document/6.导入与配置.html">
            
                    
                    2.3 导入与配置
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="document/3模型关系.html">
            
                <a href="document/3模型关系.html">
            
                    
                    第三章 模型关系
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="document/3.1属于.html">
            
                <a href="document/3.1属于.html">
            
                    
                    3.1 属于
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="document/3.2包含.html">
            
                <a href="document/3.2包含.html">
            
                    
                    3.2 包含
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="document/3.3一对多.html">
            
                <a href="document/3.3一对多.html">
            
                    
                    3.3 一对多
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="document/3.4多对多.html">
            
                <a href="document/3.4多对多.html">
            
                    
                    3.4 多对多
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="document/3.5多态一对多.html">
            
                <a href="document/3.5多态一对多.html">
            
                    
                    3.5 多态一对多
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="document/3.6多态多对多.html">
            
                <a href="document/3.6多态多对多.html">
            
                    
                    3.6 多态多对多
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="document/3.7关系嵌套.html">
            
                <a href="document/3.7关系嵌套.html">
            
                    
                    3.7 关系嵌套
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="document/4模型查询.html">
            
                <a href="document/4模型查询.html">
            
                    
                    第四章 模型查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="document/5查询范围.html">
            
                <a href="document/5查询范围.html">
            
                    
                    第五章 查询范围 Scope (预定义查询条件)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="document/6生命周期函数.html">
            
                <a href="document/6生命周期函数.html">
            
                    
                    第六章 生命周期函数 Hook
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="document/7migrate.html">
            
                <a href="document/7migrate.html">
            
                    
                    第七章 数据库迁移 Migrate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="document/8tabel2model.html">
            
                <a href="document/8tabel2model.html">
            
                    
                    第八章 根据 Table 生成 Model
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >Introduction</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x4ECB;&#x7ECD;">&#x4ECB;&#x7ECD;</h1>
<p>&#x672C;&#x4E66;&#x7531; <a href="http://nodelover.me" target="_blank">nodelover.me</a> &#x503E;&#x60C5;&#x63D0;&#x4F9B;&#x3002;</p>
<p>&#x4ED8;&#x51FA;&#x6240;&#x4EE5;&#x65F6;&#x95F4;&#x4E0E;&#x7CBE;&#x529B;&#xFF0C;&#x53EA;&#x4E3A;&#x964D;&#x4F4E;&#x5927;&#x5BB6;&#x5B66;&#x4E60;&#x7684;&#x96BE;&#x5EA6;&#xFF0C;&#x51CF;&#x5C11;&#x5B66;&#x4E60;&#x75DB;&#x82E6;&#xFF0C;&#x52AA;&#x529B;&#x505A;&#x5230;&#x53EA;&#x8981;&#x662F;&#x4EE3;&#x7801;&#x7247;&#x6BB5;&#xFF0C;&#x590D;&#x5236;&#x5C31;&#x80FD;&#x7528;&#x3002;</p>
<p>&#x672C;&#x4E66;&#x7684;&#x4EE3;&#x7801;&#x7247;&#x6BB5;&#x5728;&#x672C;&#x4E66;&#x7684; gitbook &#x4ED3;&#x5E93;&#x4E0B;&#x9762;&#x7684; code &#x6587;&#x4EF6;&#x5939;&#x5185;&#x3002;</p>
<p>&#x5047;&#x5982;&#x5E2E;&#x5230;&#x4E86;&#x4F60;&#xFF0C;&#x7ED9;&#x60A8;&#x5E26;&#x6765;&#x4E86;&#x85AA;&#x6C34;&#x4E0A;&#x7684;&#x63D0;&#x5347;&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x6765;&#x4E00;&#x74F6;&#x8001;&#x5E72;&#x5988;&#x5427; &gt;_&lt; &#x3002;</p>
<p><div align="center">
<img src="https://ww3.sinaimg.cn/large/006tKfTcgy1fgoe0q5esbj30a809yaab.jpg" alt="&#x6536;&#x6B3E;&#x7801;"></div></p>
<div>

<h2 id="&#x672C;&#x4E66;&#x7B80;&#x4ECB;">&#x672C;&#x4E66;&#x7B80;&#x4ECB;</h2>
<p>&#x672C;&#x4E66;&#x4E00;&#x5171;&#x516B;&#x4E2A;&#x7AE0;&#x8282;&#xFF0C;&#x5206;&#x522B;&#x8BB2;&#x8FF0;&#x4E86;&#x5982;&#x4F55;&#x4F7F;&#x7528; TypeScript &#x6B63;&#x786E;&#x7F16;&#x5199; Sequelize &#x6A21;&#x578B;&#xFF0C;&#x5982;&#x4F55;&#x6B63;&#x786E;&#x7684;&#x4E66;&#x5199; TS &#x4EE3;&#x7801;&#x63D0;&#x793A;&#x63A5;&#x53E3;&#xFF0C;&#x5982;&#x4F55;&#x5B9A;&#x4E49;&#x6A21;&#x578B;&#x4EE5;&#x53CA;&#x5B57;&#x6BB5;&#x7C7B;&#x578B;&#xFF0C;&#x5982;&#x4F55;&#x5B9A;&#x4E49;&#x6A21;&#x578B;&#x4E4B;&#x524D;&#x7684;&#x5173;&#x8054;&#x5173;&#x7CFB;&#xFF0C;&#x600E;&#x6837;&#x7406;&#x89E3;&#x6A21;&#x578B;&#x4E4B;&#x95F4;&#x7684;&#x5173;&#x7CFB;&#xFF0C;&#x4EC0;&#x4E48;&#x662F;&#x6A21;&#x578B;&#x5173;&#x7CFB;&#x7684;&#x591A;&#x6001;&#xFF0C;&#x5982;&#x4F55;&#x5BF9;&#x67E5;&#x8BE2;&#x6761;&#x4EF6;&#x8FDB;&#x884C;&#x9650;&#x5B9A;&#xFF0C;&#x751F;&#x547D;&#x5468;&#x671F;&#x51FD;&#x6570;&#xFF0C;&#x6570;&#x636E;&#x5E93;&#x8FC1;&#x79FB;&#x7B49;&#x3002;</p>
</div>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                
                <a href="document/1.写在前面的话.html" class="navigation navigation-next navigation-unique" aria-label="Next page: 写在前面的话">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Introduction","level":"1.1","depth":1,"next":{"title":"写在前面的话","level":"1.2","depth":1,"path":"document/1.写在前面的话.md","ref":"./document/1.写在前面的话.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"README.md","mtime":"2017-06-28T08:33:59.000Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-06-28T08:29:37.466Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

